import { RouterModule, Routes } from '@angular/router';
import { NgModule } from '@angular/core';

import { PagesComponent } from './pages.component';
import { DashboardComponent } from './dashboard/dashboard.component';
import { SmartTableComponent } from './tables/smart-table/smart-table.component';
import { TreeGridComponent } from './tables/tree-grid/tree-grid.component';
import { PrimeTableComponent } from './tables/prime-table/prime-table.component';

import { AuthGuard } from '../@core/utils/auth-guard.service';

const routes: Routes = [{
  path: '',
  component: PagesComponent,
  canActivateChild: [AuthGuard],
  children: [
    {
      path: 'dashboard',
      component: DashboardComponent
    },
    {
      path: 'tables/smart-table',
      component: SmartTableComponent
    },
    {
      path: 'tables/tree-grid',
      component: TreeGridComponent
    },
    {
      path: 'tables/prime-table',
      component: PrimeTableComponent
    },
    {
      path: 'charts',
      loadChildren: () => import('./charts/charts.module')
        .then(m => m.ChartsModule)
    },
    {
      path: 'extra',
      loadChildren: () => import('./extra/extra.module')
        .then(m => m.ExtraModule)
    }
  ]
}]

@NgModule({
  imports: [RouterModule.forChild(routes)],
  exports: [RouterModule],
})
export class PagesRoutingModule {
}
